home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / 3DDEMO.ZIP / 3D / INCLUDE / VIDEO.HPP < prev    next >
C/C++ Source or Header  |  1996-07-21  |  4KB  |  113 lines

  1. #ifndef __VIDEO__
  2.  
  3. #include <i86.h>
  4. #include <conio.h>
  5. #include <stdio.h>
  6. #include <string.h>
  7. #include <stdlib.h>
  8. #include <iostream.h>
  9. #include "defines.hpp"
  10. #include "timer.hpp"
  11.  
  12. // Copyright (c) 1996 by Kerrigan Burgess, all rights reserved.
  13.  
  14. extern void Error(char *fmt, ...);
  15.  
  16. extern "C" {
  17.  
  18. extern long _ScreenWidth,_MinClipX,_MaxClipX,_MinClipY,_MaxClipY;       // defined in polylow.asm
  19. extern unsigned char *_LookPAL, *_RendBuffer;
  20.  
  21. }
  22.  
  23. typedef struct imagestats_typ {
  24.     int width,height;
  25.     int size;
  26. } ImageStats;
  27.  
  28. class VIDEOCLASS {
  29.     
  30.   private:
  31.     unsigned char *VidMem;
  32.  
  33.     #define COLOR_MASK        0x3C6 // the bit mask register
  34.     #define COLOR_REGISTER_RD 0x3C7 // set read index at this I/O
  35.     #define COLOR_REGISTER_WR 0x3C8 // set write index at this I/O
  36.     #define COLOR_DATA        0x3C9 // the R/W data is here
  37.  
  38.     enum {NORMAL,RLE};
  39.     enum {PCX_OK,PCX_NOMEM,PCX_TOOBIG,PCX_NOFILE};
  40.  
  41.     typedef struct
  42.     {
  43.       char manufacturer;    // Always set to 0
  44.       char version;         // Always 5 for 256-color files
  45.       char encoding;        // Always set to 1 
  46.       char bits_per_pixel;  // Should be 8 for 256-color files 
  47.       short int xmin,ymin;       // Coordinates for top left corner 
  48.       short int xmax,ymax;       // Width and height of image 
  49.       short int hres;            // Horizontal resolution of image 
  50.       short int vres;            // Vertical resolution of image 
  51.       unsigned char palette16[48];   // EGA palette; not used for 256-color files
  52.       char reserved;        // Reserved for future use 
  53.       char color_planes;    // Color planes
  54.       short int bytes_per_line;  // Number of bytes in 1 line of pixels 
  55.       short int palette_type;    // Should be 2 for color palette 
  56.       char filler[58];      // Nothing but junk 
  57.     } PcxHeader;
  58.  
  59.     typedef struct
  60.     {
  61.       PcxHeader hdr;
  62.       unsigned char *bitmap;
  63.       unsigned char pal[768];
  64.       short int width,height;
  65.       int imagebytes;
  66.     } PcxFile;
  67.  
  68.   int prevmode;
  69.   int MEMSIZE;          // size of VidMem for various modes.
  70.   int bgcolor;
  71.   int Shades;           // how many shades of palette.
  72.   
  73.   PcxFile *pcx;
  74.   ImageStats Stats;                      // holds stats of image.
  75.  
  76.   unsigned long int PcxSize;             // Size of PCX file
  77.   unsigned char CurrentPalette[768];        // holds colors of the currentpalette.
  78.   
  79.   unsigned char *Background;             // holds background picture, if there.
  80.   unsigned char *VideoBuffer;                 // holds double buffer.  
  81.  
  82.   public:
  83.     VIDEOCLASS(void);
  84.    ~VIDEOCLASS(void);
  85.  
  86.     void InitVideo(int Mode);
  87.     void LoadBackground(char *filename);
  88.     void DeleteBackground(void);
  89.     unsigned char *LoadPcxFile(char *filename);
  90.     void SetAllRgbPalette(void);
  91.     void SetPaletteArg(unsigned char *pal);
  92.     void CreateRGBPalette(void);
  93.     void LoadTextureMap(char *filename);
  94.     void LoadPalTable(char *filename);
  95.     void LoadPalPhongTable(char *filename);
  96.     void LoadPhongTBL(char *filename);
  97.     int  LoadTransTable(char *filename);
  98.     void LoadHazeTable(char *filename);
  99.     ImageStats *GetStats();
  100.     void ClearBuffer(void);
  101.     unsigned char *GetBuffer(void);
  102.     unsigned char *CreateBuffer(int color);
  103.     void Buf2Video(void);
  104.     void FadeToBlack(void);
  105.     void FadeToColor(void);
  106.     void SetClipExtents(int XMinClip,int YMinClip,int XMaxClip,int YMaxClip,
  107.                         int HitherClip,int YonClip);
  108. };
  109.  
  110. #define __VIDEO__
  111. #endif
  112.  
  113.